package com.example.musicplayer.util;

import android.media.MediaPlayer;

public class SingletonMediaPlayer extends MediaPlayer {
    private volatile static SingletonMediaPlayer mediaPlayer;
    private SingletonMediaPlayer (){}
    public static SingletonMediaPlayer getMediaPlayer() {
        if (mediaPlayer == null) {
            synchronized (SingletonMediaPlayer.class) {
                if (mediaPlayer == null) {
                    mediaPlayer = new SingletonMediaPlayer();
                }
            }
        }
        return mediaPlayer;
    }
}
